//
//  WShareUtil.h
//  WArtMarket
//
//  Created by 武根宝 on 17/1/24.
//  Copyright © 2017年 环球巨人. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "PlayerModel.h"
#import "GifView.h"

@interface WShareUtil : NSObject

//换ip次数
@property (nonatomic, assign) int reqNum;
//循环ip次数
@property (nonatomic, assign) int cirReqNum;

//账户余额
@property (nonatomic, copy) NSString *strRemaining;

//会员
@property (nonatomic, copy) NSString *strlxmc;

//区别返回时的首页
@property (nonatomic, copy) NSString *strController;

// 从我的订单购买
@property (nonatomic, assign) BOOL isWDDD;

// 课程标示字典
@property (nonatomic, strong)NSDictionary *dicSleSymbol; //选择课程标示
@property (nonatomic, strong)NSDictionary *dicBuySymbol; //购买课程标示

@property (nonatomic, assign) BOOL isFristStart;

@property (nonatomic, copy) NSString *LASTVersion;//沙盒版本号
@property (nonatomic, strong) NSArray *arrayOfAds;
@property (nonatomic, strong) NSArray *arrShOfAds;
@property (nonatomic, strong) NSArray *arrShOfTit;

@property (nonatomic, copy) NSString *strLevel;
@property (nonatomic, copy) NSString *strLevel2;

// 临时属性==============
@property (nonatomic, copy)NSString *strToken;

//音频播放列表
@property (nonatomic, strong)NSArray *arrPlayList;
@property (nonatomic, assign)BOOL isPlay;
@property (nonatomic, assign)BOOL isShowTool;
@property (nonatomic, strong)PlayerModel *playerModel;
@property (nonatomic, strong)NSMutableDictionary *dicMplayTime;
@property (nonatomic, strong)NSArray *arrList;
@property (nonatomic, copy) NSString *AnswerSortListLevel1;
@property (nonatomic, copy) NSString *AnswerSortListLevel2;
@property (nonatomic, copy) NSString *AnswerSortListLevel3;
@property (nonatomic, copy) NSString *AnswerSortNavTitle;
@property (nonatomic, copy) NSString *SmallTpyzm;//登录小写图片验证码
@property (nonatomic, copy) NSString *RegistSmallTpyzm;//注册小写图片验证码
@property (nonatomic, copy) NSString *RegistSMSyzm;//注册短信验证码打印
@property (nonatomic, strong)NSDictionary *dicRegist;//注册返回信息保存

//是听税列表跳转
@property (nonatomic, assign)BOOL isHeartaxList;

//======================
@property (nonatomic, strong)NSDictionary *dicSession;
@property (nonatomic, strong)NSDictionary *dicYouKeSession;

@property (nonatomic, strong)NSMutableArray *arrMdiagram;
@property (nonatomic, assign)int j;

//发票类型
@property (nonatomic, assign)BOOL isHaveInvoice;
@property (nonatomic, strong)NSMutableDictionary *dicMinvoice;
@property (nonatomic, strong)NSDictionary *dicOrder;
@property (nonatomic, strong)NSDictionary *dicMemberOrder;
@property (nonatomic, copy) NSString *orderId;
@property (nonatomic, copy) NSString *productId;
@property (nonatomic, copy) NSString *memberId;
@property (nonatomic, assign)BOOL isMember;

//视频详情标题
@property (nonatomic, copy) NSString *VideoTitle;
@property (nonatomic, copy) NSString *Who;//是谁调起的登录页
@property (nonatomic, strong)NSMutableDictionary *DicState;//首页服务器状态请求后保存的单例字典

// 服务状态分享所需的字段
@property (nonatomic, copy) NSString *shareTITLE;//分享标题
@property (nonatomic, copy) NSString *shareSUMMARY;//分享概要
@property (nonatomic, copy) NSString *shareLINK;//分享地址
@property (nonatomic, copy) NSString *shareIMG;//分享图片

// 不现实等待动画
@property (nonatomic, assign)BOOL isShowWait;

@property (nonatomic, assign)NSUInteger tabbarIndex;

+(NSString *)getUUID;

/*!
 *  @brief  显示等待层
 *
 *  @param isShow 是否显示等待层
 */
+ (void)showWait:(BOOL)isShow frame:(CGRect)frame;

+ (WShareUtil *)sharedData;

+ (NSString *)getServerURL:(NSString *)url;

//是否越狱
+(BOOL)isJailBreak;

//获取当前时间的时间托
+(NSString *)timeString;

/**
 *  获取设备类型
 *
 */
+(NSString *)GetDeviceRealType;

+(NSString *)getDeviceInfo;

+(NSString *)getDeviceOSType;

+(NSString *)getDeviceNumber;

// 得到一个随即的字符串，输入长度
+ (NSString *)getStringWithLength:(NSUInteger)length;

// 得到一个随即字符,从以下字符中取一个
+ (NSString *)getAnCharacter;


//去除掉首尾的空白字符和换行字符
+ (NSString *)stringByTrimmingCharactersInSetOrSpaceStr:(NSString *)str;

/*!
 @method
 @abstract  判断字符串是否为空或nil
 */
+ (BOOL)strNilOrEmpty:(NSString *)string;

/*!
 @method
 @abstract  浏览器打开地址
 */
+ (void)openUrl:(NSString *)url;

/*!
 @method
 @abstract  角度转弧度
 @param     degrees 角度
 @result    CGFloat 转换后的弧度
 */
+ (CGFloat)degreeToRadian:(CGFloat)degrees;

/*!
 @method
 @abstract  弧度转角度
 @param     radians 弧度
 @result    CGFloat 转换后的角度
 */
+ (CGFloat)radianToDegree:(CGFloat)radians;

//将十六进制的颜色值转换为uicolor:rrggbbhh
+ (UIColor*)hexColor:(NSString*)hexColor;

//文件全路径
+(NSString *)fileMainBundleName:(NSString *)strFileName;

//写图片到路径 aPath
+(BOOL)writeImage:(UIImage*)image toFileAtPath:(NSString*)aPath;

//是否存在目录或文件
+(BOOL)fileIsExistPath:(NSString *)filePath;

//创建目录
+(BOOL)fileCreateDirectory:(NSString *)directoryPath;

//删除文件
+(BOOL)fileDelete:(NSString *)filePath;

//创建文件
+(BOOL)fileWriteToPath:(NSString *)filePath data:(NSData*)data;

//获取目录下所有文件名称
+(NSArray *)fileSubFileNames:(NSString *)filePath;

//拷贝文件到路径下
+(BOOL)fileCopy:(NSString *)sourcePath toPath:(NSString*)toPath;

//计算文件夹下文件的总大小
+(long)fileSizeForDir:(NSString*)path;

// 压缩图片
+(UIImage *)compressImage:(UIImage *)image toByte:(NSUInteger)maxLength;

#pragma mark--自适应高度宽度
+ (CGSize)calculationHeightWidth:(NSString *)str andSize:(float)fontSize andCGSize:(CGSize)size;

//苹果系统版本号比较区间
+ (BOOL)systemVersionCompare;

// 汉字转拼音
+ (NSString *)transform:(NSString *)chinese;

//从 Bundle 中加载图片方法
+ (UIImage *)urlTransformImgUrl:(NSString *)imageName;

//从 html 里面取出 图片 url
+ (NSArray *)filterImage:(NSString *)html;


// 各种保存 =================================
// 保存json文件
+ (void)saveJsonData:(NSDictionary *)JsonDic WithFile:(NSString *)FilePath;

+ (id)readJsonDataFromFile:(NSString *)FilePath;

+ (void)removeJsonDataWithFile:(NSString *)FilePath;


// 保存自定义数据字典
+ (void)saveModelData:(NSArray *)modelData WithFile:(NSString *)FilePath;

+ (NSArray *)readModelDataFromFile:(NSString *)FilePath;

+ (void)removeModelDataWithFile:(NSString *)FilePath;


//NSUserDefaults 保存
+ (void)saveDataWithUserDefaultsSetObject:(id)object ForKey:(NSString *)key;

+ (id)getDataWithUserDefaultsForKey:(NSString *)key;

+ (void)removeDataWithUserDefaultsForKey:(NSString *)key;


//HTML转义
+ (NSString *)filterHTML:(NSString *)html;

// 弹出系统警告框
+ (UIAlertView *)showAlert:(NSString *)title message:(NSString *)msg;

// 时间格式
+ (NSString *)timeFormat:(NSString *)strDate;

// web页面参数拼接
+ (NSString *)webUrlAppendingString:(NSString *)url dic:(NSDictionary *)parametersDict;

/**
 *  显示隐藏等待层
 *
 */
+ (void)ShowWaitView:(BOOL)IsShow;

+ (void)setStatusBarBackgroundColor:(UIColor *)color;

// 动画方法
+ (GifView *)animatedGifWithData:(UIImageView *)imgView;
+ (GifView *)animatedGifWithDataSize:(CGSize)size;

#pragma mark - 一键检测网络请求
+ (void)YJJCDataRequest:(NSString *)url success:(void (^)(NSString *successUrl))successUrl failure:(void (^)(NSString *failureUrl))failureUrl;

@end
